﻿package mortal.game.view.friend
{
    import Message.Game.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import flash.display.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class SelectedCellRenderer extends GCellRenderer
    {
        private var _roleLevel:GTextFiled;
        private var _roleCareer:GTextFiled;
        private var _roleName:GTextFiled;
        private var _fightValue:GTextFiled;
        private var _spr:Sprite;
        private var _isSelected:Boolean;
        private var _recordId:Number;
        private var _roleId:int;
        private var _friendInfo:SFriendRecord;

        public function SelectedCellRenderer()
        {
            this.setSize(313, 24);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._spr = new Sprite();
            this.addChild(this._spr);
            this._roleLevel = UIFactory.gTextField("", 15, 2, 32, 20, this, GlobalStyle.textFormatDanLan);
            this._roleCareer = UIFactory.gTextField("", 50 + 10, 2, 44, 20, this, GlobalStyle.textFormatDanLan);
            this._roleName = UIFactory.gTextField("", 134, 2, 98, 20, this, GlobalStyle.textFormatDanLan);
            this._fightValue = UIFactory.gTextField("", 248, 2, 45, 20, this, GlobalStyle.textFormatChen);
            this.pushUIToDisposeVec(UIFactory.bg(0, 25, 316, 1, this, ImagesConst.SplitLine));
            return;
        }// end function

        override protected function initSkin() : void
        {
            var _loc_1:* = new GBitmap();
            var _loc_2:* = UIFactory.bg(0, 0, 0, 0, null, ImagesConst.SelectBg);
            this.setStyle("downSkin", _loc_2);
            this.setStyle("overSkin", _loc_2);
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", _loc_2);
            this.setStyle("selectedOverSkin", _loc_2);
            this.setStyle("selectedUpSkin", _loc_2);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._friendInfo = param1.data;
            this._roleLevel.text = this._friendInfo.friendPlayer.level + Language.getString(41263);
            this._roleCareer.text = GameDefConfig.instance.getECareer(this._friendInfo.friendPlayer.career).text;
            this._roleName.text = this._friendInfo.friendPlayer.name;
            this._recordId = this._friendInfo.recordId;
            this._fightValue.text = "" + this._friendInfo.friendPlayer.combat;
            if (Cache.instance.friend.getDeleteInfo(this._recordId))
            {
                this._roleLevel.textColor = GlobalStyle.colorHongUint;
                this._roleCareer.textColor = GlobalStyle.colorHongUint;
                this._roleName.textColor = GlobalStyle.colorHongUint;
                this._fightValue.textColor = GlobalStyle.colorHongUint;
            }
            else
            {
                this._roleLevel.textColor = GlobalStyle.colorDanLanUint;
                this._roleCareer.textColor = GlobalStyle.colorDanLanUint;
                this._roleName.textColor = GlobalStyle.colorDanLanUint;
                this._fightValue.textColor = GlobalStyle.colorChenUint;
            }
            return;
        }// end function

        public function set isSelected(param1:Boolean) : void
        {
            this._isSelected = param1;
            if (param1)
            {
                this._roleLevel.textColor = GlobalStyle.colorHongUint;
                this._roleCareer.textColor = GlobalStyle.colorHongUint;
                this._roleName.textColor = GlobalStyle.colorHongUint;
                this._fightValue.textColor = GlobalStyle.colorHongUint;
            }
            else
            {
                this._roleLevel.textColor = GlobalStyle.colorDanLanUint;
                this._roleCareer.textColor = GlobalStyle.colorDanLanUint;
                this._roleName.textColor = GlobalStyle.colorDanLanUint;
                this._fightValue.textColor = GlobalStyle.colorChenUint;
            }
            return;
        }// end function

        public function get isSelected() : Boolean
        {
            return this._isSelected;
        }// end function

        public function get roleName() : String
        {
            return this._roleName.text;
        }// end function

        public function get recordId() : Number
        {
            return this._recordId;
        }// end function

        public function get roleId() : int
        {
            return this._roleId;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._roleLevel.dispose(param1);
            this._roleCareer.dispose(param1);
            this._roleName.dispose(param1);
            this._fightValue.dispose(param1);
            this._roleLevel = null;
            this._roleCareer = null;
            this._roleName = null;
            this._fightValue = null;
            return;
        }// end function

    }
}
